package com.example.yucheng.mapper;

import com.example.yucheng.domain.Stock;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StockMapper {

//    @Select("select * from stock limit #{pageNum} , #{pageSize};")
    List<Stock> getStockList(int pageNum, int pageSize);

//    @Update("update stock set name =#{name},c_id=#{cId},remark=#{remark} where id = #{id}")
    void updateStock(Stock stock);

    @Delete("delete from stock where id = #{id}")
    void deleteStock(int id);

    @Insert("insert stock set c_id=#{cId},name=#{name},per=#{per},remark=#{remark},time=NOW(),number=0")
    void addStock(Stock stock);

    @Select("select * from stock where name = #{name}")
    Stock findStock(String name);

    @Update("update stock set number = #{number} where id=#{id}")
    void updateStockNumber(Stock stock);

//    @Select("select * from stock")
    List<Stock> getAllGood();

    @Select("select * from stock where id=#{gId}")
    Stock findGoodNumber(int gId);
}
